#pragma once

#include <QtGui/QPainter>
#include <QtGui/QGraphicsItem>
#include <QtGui/QGraphicsLineItem>
#include "station.h"

#define M_PI 3.14159265358979323846

class CConnection :
	public QGraphicsLineItem
{
protected:
	CStation      * m_begin;
	CStation      * m_finish;
	QColor          m_color;
public:
	CConnection(CStation *startItem, CStation *endItem,
				QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
	~CConnection(void);

	QRectF boundingRect() const;
    QPainterPath shape() const;

	void updatePosition();

protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget = 0);
public:
	enum { Type = UserType + 16 };
	int type() const
         { return Type;}
};

